﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MagicBag.CRM.Model;
using MagicBag.CRM.IDAL;

namespace MagicBag.CRM.BLL
{
    public class MenuBLL
    {
        //创建数据访问对象
        private static readonly IMenu menuDAL = DALFactory.DataAccess.CreateMenu();

        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="menu"></param>
        /// <returns></returns>
        public int Insert(Menu menu)
        {
            return menuDAL.Insert(menu);
        }

        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Delete(int id)
        {
            return menuDAL.Delete(id);
        }

        /// <summary>
        /// 修改菜单
        /// </summary>
        /// <param name="menu"></param>
        /// <returns></returns>
        public int Update(Menu menu)
        {
            return menuDAL.Update(menu);
        }

        /// <summary>
        /// 获取所有菜单
        /// </summary>
        /// <returns></returns>
        public IList<Menu> GetMenus()
        {
            return menuDAL.GetMenus();
        }
    }
}
